]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
popupMenu: Use a checkmark for boolean items
authorJasper St. Pierre <jstpierre@mecheye.net>
Sat, 20 Apr 2013 01:16:19 +0000 (21:16 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Tue, 23 Apr 2013 19:50:36 +0000 (15:50 -0400)
This matches GTK+'s styling, and it makes most boolean switches
look more natural, as a lot of booleans are not meant for hardware
switches.

https://bugzilla.gnome.org/show_bug.cgi?id=698427

js/ui/popupMenu.js

index 9844baf2e6084d0ec917fdc57d7fbb8a52830b25..041434eac68492f0d148c9ab8e75106e1a1e3b17 100644 (file)
@@ -1869,18 +1869,20 @@ const RemoteMenu = new Lang.Class({
             // always returns null
             // Funny :)
 
+            item = new PopupMenuItem(label);
+
             switch (String.fromCharCode(action.state.classify())) {
             case 'b':
-                item = new PopupSwitchMenuItem(label, action.state.get_boolean());
                 action.items.push(item);
-                specificSignalId = item.connect('toggled', Lang.bind(this, function(item) {
+                item.setOrnament(action.state.get_boolean() ?
+                                 Ornament.CHECK : Ornament.NONE);
+                specificSignalId = item.connect('activate', Lang.bind(this, function(item) {
                     this.actionGroup.activate_action(action_id, null);
                 }));
                 break;
             case 's':
-                item = new PopupMenuItem(label);
-                item._remoteTarget = model.get_item_attribute_value(index, Gio.MENU_ATTRIBUTE_TARGET, null).deep_unpack();
                 action.items.push(item);
+                item._remoteTarget = model.get_item_attribute_value(index, Gio.MENU_ATTRIBUTE_TARGET, null).deep_unpack();
                 item.setOrnament(action.state.deep_unpack() == item._remoteTarget ?
                                  Ornament.DOT : Ornament.NONE);
                 specificSignalId = item.connect('activate', Lang.bind(this, function(item) {
@@ -2010,7 +2012,8 @@ const RemoteMenu = new Lang.Class({
             switch (String.fromCharCode(action.state.classify())) {
             case 'b':
                 for (let i = 0; i < action.items.length; i++)
-                    action.items[i].setToggleState(action.state.get_boolean());
+                    action.items[i].setOrnament(action.state.get_boolean() ?
+                                                Ornament.CHECK : Ornament.NONE);
                 break;
             case 'd':
                 for (let i = 0; i < action.items.length; i++)